This invention relates to the publish-and-subscribe system and, more specifically, to methods and apparatus for integrating a content-based publish-and-subscribe system with a relational database system.
Communication models are used to handle the complexity of receiving messages from and distributing messages to multiple nodes in a distributed computing environment. An example of a communication model that is widely used is the publish-and-subscribe interaction system among applications. Entities that produce the messages or information are xe2x80x9cpublishersxe2x80x9d and entities that are interested in the messages are xe2x80x9csubscribersxe2x80x9d. The publish-and-subscribe model involves an asynchronous messaging capability, i.e., publishers need not wait for subscribers. For example, a producer of information simply xe2x80x9cpublishesxe2x80x9d information on multiple communication channels and the consumer of information xe2x80x9csubscribesxe2x80x9d to the channels of interest. The publish-and-subscribe paradigm is said to be event-driven because communication between the producer of information and the consumer of information is triggered by business events. Also, the asynchronous nature of the messages dictates that any incoming message is an event.
In general, a messaging system uses a set of rules to ensure that a particular message gets to the right subscriber(s). A rule is a condition that describes the message or messages that are desired by a subscriber. A rules engine is used to apply the rules to the messages. There are a variety of standards governing the expression of the rules and the structure of the messages. However, there is no single standard that is widely used. The lack of a widely used standard has resulted in disparate tool sets for working with historical information (existing messages) versus future information (incoming messages). It is inefficient to maintain disparate tool sets in a messaging system.
Based on the foregoing, there is a need for a method or mechanism to implement the content-based publish-and-subscribe system in an environment with widely used standards and to use a common tool set for working with historical information and future information.
According to one aspect of the invention, an expression used in queries that is written in a query language supported by a relational database system is received from a subscriber and stored as a rule to determine whether an incoming message is to be sent to the subscriber. If the incoming message satisfies the rule, then the message is delivered to the subscriber. In one embodiment, the evaluation of the rules for determining whether an incoming message is to be sent to a subscriber is performed using a two-tier evaluation method. In another aspect of the invention, messages are implicitly published to the subscriber when the publisher is the relational database system itself.
According to another aspect of the invention, the use of well established standards of a query language such as Structured Query Language (xe2x80x9cSQLxe2x80x9d) in a content-based publish-and-subscribe system enables the publish-and-subscribe system to take advantage of the existing knowledge base and toolsets of the query language.
According to another aspect of the invention, a method is provided for processing queries in a database system. The method includes receiving, from a client, a query that is written in a query language supported by the database system, wherein the query is a request for data stored in the database system that satisfies the query. The method also includes detecting that the data stored in the database system has been changed and in response to detecting that the data stored in the database system has been changed, providing the changed data to the client.